import cv2
import numpy as np

# 读取图像
image = cv2.imread('../temp/image.jpg')
if image is None:
    print('Cannot read image file')
    exit(-1)

# 将图像转换为灰度图像
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)

# 进行高斯模糊
gray = cv2.GaussianBlur(gray, (3, 3), 0)

# 进行Canny滤波
edges = cv2.Canny(gray, 100, 200)

# 显示原始图像和Canny滤波后的图像
cv2.namedWindow('Original Image', cv2.WINDOW_NORMAL)
cv2.namedWindow('Canny Image', cv2.WINDOW_NORMAL)
cv2.imshow('Original Image', image)
cv2.imshow('Canny Image', edges)

cv2.waitKey(0)
cv2.destroyAllWindows()
